function maxTwoSum(arr){
    if(arr.length < 2){
        throw new Error('arr must be at least 2 elements')
    }

   arr = [...arr].sort((a,b)=> a- b)
   const len = arr.length
   return arr[len-1] + arr[len-2]
}